<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>

<!DOCTYPE html>
<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>云医通开放性接口平台</title>
<link rel="stylesheet" type="text/css" href="./css/mserver.css" />
<link rel="stylesheet" type="text/css" href="./css/calender.css" />
<link rel="stylesheet" type="text/css" href="./css/mserverother.css" />
<link rel="stylesheet" type="text/css" href="./css/tip-yellow.css" />
<link rel="stylesheet" type="text/css" href="./css/tip-darkgray.css" />
<link rel="stylesheet" type="text/css" href="./css/tableStyle.css" />
<script src="./js/jquery-1.8.0.min.js"></script>
<script src="./js/Common.js"></script>
</head>

<body>
	<div class="mserver imenu">
		<div class="header">
			<div class="inner cf" style="position: relative;">
				<a title="云医通开放性接口平台系统" href="Document.jsp">
					<h2>
						<span></span>
					</h2>
				</a>
				<ul>
					<li><a id="documentCenter" title="文档中心" target="_self">文档中心</a> <em style="display: block; margin-top: -1px; height: 8px;"></em></li>

					<li><a id="applicationCenter" href="javascript:void(0);" title="" target="_self">应用接入</a></li>
				</ul>
				<div class="ibtn">
					<a href="javascript:void(0);" title="登录" target="_self" class="btn_log"><span>登录</span></a> <a style="cursor: pointer;" title="设置个人信息" target="_self" class="btn_info" href="javascript:void(0);"><span>设置个人信息</span></a>
				</div>
				<div style="clear: right;"></div>
                <div class="ibtn" style="position: absolute; bottom: 0px; right: 0px;">
                    <input id="txt_Search" type="text" />
                    <a href="javascript:Public.SearchAPI();" title="查找" target="_self" class="btn_Search"><span>查找</span></a>
                </div>
			</div>
		</div>
		<input type="hidden" id="local_url" value="" />
		<div class="open_wrap">
			<div class="title_logo">
				<img src="./images/open_title.png" />
			</div>

			<div class="open_content">
				<div class="open_main clearfix">

					<div class="left">
						<div class="open2_menu_all">
							<h1>
								<a href="Document.jsp">
									<div>返回接口列表</div>
								</a>
							</h1>
							<ul class="open2_menu" style="display: block;">
							</ul>
						</div>
					</div>
					<!-- end of left -->

					<div class="right">
						<div class="api_list">
							<h1 id="api_title"></h1>
							<ul>
								<li><a href="#125">分类概述</a></li>
								<li><a href="#247">API列表</a></li>
							</ul>
						</div>
						<ul class="detail_list">
							<li style="padding-bottom: 20px;">
								<div class="title">
									<h2>
										<a name="125">分类概述</a>
									</h2>
									<a class="show" style="cursor: pointer;">[隐藏]</a>
								</div>
								<div class="theme_content" style="text-indent: 24px;">
									<p id="api_description"></p>
									<a name="125" class="more"></a>
								</div>
							</li>
							<li style="padding-bottom: 20px;">
								<div class="title">
									<h2>
										<a name="247">API列表</a>
									</h2>
									<a class="show" style="cursor: pointer;">[隐藏]</a>
								</div>
								<div class="theme_content" style="text-indent: 24px;">
									<p></p>
									<div>&nbsp;</div>
									<div>
										<table id="tb_apilist" width="100%" class="ke-zeroborder kindTable kindTable1">
											<tbody>
											</tbody>
										</table>
									</div>
									<p>&nbsp;</p>
									<a name="247" class="more"></a>
								</div>
							</li>
						</ul>
					</div>
					<!-- end of right -->

				</div>
				<!-- end of open_main -->
			</div>
			<!-- end of open_content -->
		</div>
		<!-- end of open_wrap -->

		<div class="footer" style="clear: both; margin-top: 600px;">
			<p>Copyright &copy; 广州云医科技有限公司 2015-2016, All Rights Reserved</p>
		</div>

		<a href="#" class="go_top"></a>
	</div>

	<script type="text/javascript">
       var apiClassId = '';
        function ApiClass_Callback(ret) {
            var ex = false;
            if (ret) {
                var open2_menu = '';

                for (var i = 0; i < ret.length; i++) {
                    open2_menu += '<li><a id="apiclass_' + ret[i].id + '" href="API.jsp?apiClassId=' + ret[i].id + '"><div>' + ret[i].apiClassName + '</div></a></li>';

//                    if (ret[i].apiClassId == apiClassId) {
                        ex = true;
                        $('#api_title').text(ret[i].apiClassName);
                        $('#api_description').text(ret[i].description);
//                    }
                }

                if ($.trim(open2_menu).length > 0) {
                    $('.open2_menu').append(open2_menu);
                    $('#apiclass_' + apiClassId).addClass('now');
//                    if (!ex) {
//                        alert('没有该接口信息');
//                        window.location.href = "Document.jsp";
//                    }
                }
            }
        }

        function Api_Callback(ret) {
            if (ret) {
                var tb_apilist = '';
                for (var i = 0; i < ret.length; i++) {
                    tb_apilist += '<tr><td><em></em><a target="_blank" href="ApiDetails.jsp?apiClassId=' + apiClassId + '&apiId=' + ret[i].id + '">' + ret[i].apiDefine + '</a></td><td>' + ret[i].apiName + '</td></tr>';
                }

                if ($.trim(tb_apilist).length > 0) {
                    $('#tb_apilist tbody').append(tb_apilist);
                }
            }
        }

        function CheckUrl() {
			apiClassId = Public.GetUrlParam('apiClassId');
            if ($.trim(apiClassId).length == 0) {
                alert('参数错误');
                window.location.href = "Document.jsp";
            }
        }
        
        $(function () {
        	path = "<%=path%>/";
			CheckUrl();

			Public.ajaxPost(window.parent.path + apis["getApiClass"], null, ApiClass_Callback, null);
			Public.ajaxPost(window.parent.path + apis["getApi"] + "?apiClassId=" + apiClassId, null, Api_Callback, null);

			$(".show").click(function() {
				Public.Fold(this);
			});
		});
	</script>
</body>
</html>